const jwt = require("jsonwebtoken");
const { expiresIn } = require("../config/app");

module.exports = {
  createToken(data) {
    return jwt.sign(data, process.env.SECRET, { expiresIn });
  },
  verifyToken(token) {
    try {
      return jwt.verify(token, process.env.SECRET);
    } catch (error) {
      return false;
    }
  },
};
